package com.treeman.api.security.context;

import java.util.Collection;

import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

import com.treeman.user.User;

public class AccessTokenAuthenticationToken extends AbstractAuthenticationToken {

	private static final long serialVersionUID = 1L;

	private Object credentials;
	private Object principal;

	public AccessTokenAuthenticationToken(User user, String accessToken,
			Collection<? extends GrantedAuthority> authorities) {
		super(authorities);
		this.credentials = accessToken;
		this.principal = user;
		super.setAuthenticated(true);
	}

	@Override
	public Object getCredentials() {
		return credentials;
	}

	@Override
	public Object getPrincipal() {
		return principal;
	}
}
